﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Ex03.VehicalsObjectModel
{
    public class ElectricMotocycle : MotoCycle, IElectricVehical
    {
        // Members
        private const int k_ChargeCapacity = 180;
        private ElectricEnergySystem m_ElectricEnergySystem;

        // Ctor

        /// <summary>
        /// Creates a new electiricity based motocycle
        /// </summary>
        /// <param name="i_LicenseNumber">The license number of the motocycle</param>
        internal ElectricMotocycle(string i_LicenseNumber)
            : base(i_LicenseNumber, new ElectricEnergySystem(k_ChargeCapacity))
        {
            m_ElectricEnergySystem = m_EnergySystem as ElectricEnergySystem;
        }
        
        #region IElectricVehical Members

        /// <summary>
        /// Charges the energy system with a given duration
        /// </summary>
        /// <param name="i_AddedDuration">The duration in minutes</param>
        /// <exception cref="ValueOutOfRangeException">When the amount is negative or exceeds the capacity of the system</exception>
        public void Charge(int i_AddedMinutes)
        {
            m_ElectricEnergySystem.Charge(i_AddedMinutes);
        }

        /// <summary>
        /// Gets the availabe minutes of electiricy in the charge
        /// </summary>
        public int CurrentDuration
        {
	        get 
            {
                return m_ElectricEnergySystem.CurrentElectricityDuration;
            }
        }

        /// <summary>
        /// Gets the maximum minutes of electiricy the charge can hold
        /// </summary>
        public int MaximumDuration
        {
            get 
            {
                return m_ElectricEnergySystem.MaxElectricityDuration;
            }
        }

        #endregion
    }
}
